Release 0.4.0: grammar fixes, auto-indent fix, updated docs#24
Merged
Conversation
Allow ScopeResolution to start with :: prefix for top-level constant references like ::TopLevel and ::TopLevel::Foo. Also support :: prefix in className for class/module definitions. Uses ~scopeOrClass GLR marker to resolve ambiguity between className's :: repetition and ScopeResolution.
Add HashPattern and HashPatternPair rules reachable only from InClause
for Ruby 3.0+ pattern matching. Supports {name: String => n} binding
syntax and {name:} shorthand. Uses ~hashOrPattern GLR marker to resolve
ambiguity with regular Hash/HashPair rules.
Add FindPattern rule reachable from InClause for Ruby 3.0+ find patterns. Requires leading * to unambiguously distinguish from regular Array. Supports [*, value, *] and [*pre, value, *post] forms.
- Fix rubyIndentService to use cx.lineAt() instead of raw doc access, so auto-indent on Enter respects simulateBreak - Update README: add new features to "What's supported", remove stale limitations (symbol-key shorthand, ::TopLevel, hash/find patterns), add guard clause limitation, update Rails benchmark 94.2% → 94.3% - Rebuild demo for GitHub Pages - Bump version to 0.4.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
::TopLevelscope resolution, hash patterns incase/in, find patterns[*, 2, *]rubyIndentServicenow usescx.lineAt()instead of rawdoc.lineAt()/doc.line(), respectingsimulateBreakfor real-time indent behaviorGrammar changes
::TopLevel(BUG-015b)"::" (Constant | Identifier)variant toScopeResolution,"::"?prefix toclassNameHashPattern/HashPatternPairrules inInClausewith~hashOrPatternGLRif/unlessconflicts withIfStatement— unresolvable in LR parserFindPatternrule requiring leading*to disambiguate fromArrayTest results
npm test: 105 passingindent.test.mjs: 247 pass, 0 failhighlight.test.mjs: 139 pass, 0 failfold.test.mjs: 25 pass, 0 failgrammar.test.mjs: 39 pass, 0 failintegration.test.mjs: 10 pass, 0 failbug-check.mjs: 114 pass, 3 fail (down from 6 — remaining 3 are the skipped bugs)Test plan
npm run build && npm test— all 105 grammar tests passdef fooauto-indents correctly::TopLevel,{name: String => n},[*, 2, *]parse without errors🤖 Generated with Claude Code